package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {
    /**
     * 微信登录
     * @param user
     * @return
     */
    void insert(User user);

    /**
     * 查询用户信息是否存在
     * @param openid
     * @return
     */
    @Select("select * from user where openid=#{openid}")
    User selectByOpenid(String openid);

    /**
     *根据用户id查询信息
     * @param userId
     * @return
     */
    @Select("select * from user where id =#{userId}")
    User getById(@Param("userId") Long userId);

    /**
     * 统计用户数量
     * @param map
     * @return
     */
    Integer getCountUserMap(Map map);
}
